<?php

/**
 * 默认接口服务类
 * @author: dogstar <chanzonghuang@gmail.com> 2014-10-04
 */
class Api_DB extends PhalApi_Api {

    public function getRules() {

        return array(
            'index' => array(),
        );
    }

    public function index() {

        $rs = DI()->notorm->user->fetch();

        $rs = DI()->notorm->user->fetchALL();

        $rs = DI()->notorm->user->where("id != ?", 5)->fetch();

        $rs = DI()->notorm->user->where("id", array(1,5))->fetchALL();

        //return $rs;

        /* $rs = DI()->notorm->user->where("id", 5)->update(array("name" => "喵了个咪"));

         if($rs === false){
             //更新失败的处理
         }

         return $rs;*/

        /*$rs = DI()->notorm->user->insert(array("name" => "test"));

        return $rs;*/

        /*$rs = DI()->notorm->user->where("id",11)->delete();

        return $rs;*/

        /*$model_user = new Model_User();
        $rs = $model_user->getinfoByid(5);
        return $rs;*/

       /* $sql    = "select * from tbl_user where id = :id";
        $params = array(
            ":id" => 5
        );
        $rs     = DI()->notorm->example->queryAll($sql, $params);*/
        return $rs;
    }
}
